package com.kupurui.asteacher.adapter;

import android.content.Context;
import android.widget.TextView;

import com.android.frame.adapter.CommonAdapter;
import com.android.frame.adapter.ViewHolder;
import com.android.frame.http.HttpListener;
import com.kupurui.asteacher.R;
import com.kupurui.asteacher.bean.JobInfo;
import com.kupurui.asteacher.bean.NewJobInfo;

import java.util.List;

/**
 * Created by Administrator on 2017/7/21.
 */

public class JobChildAdapter extends CommonAdapter<NewJobInfo.FabuBean.HomeworkBean> {


    public JobChildAdapter(Context context, List<NewJobInfo.FabuBean.HomeworkBean> mList, int itemLayoutId) {
        super(context, mList, itemLayoutId);
    }

    @Override
    public void convert(ViewHolder holder, NewJobInfo.FabuBean.HomeworkBean item, int positon) {
        holder.setTextViewText(R.id.tv_title,item.getTitle()+"/共"+item.getWork_number()+"题");
        holder.setTextViewText(R.id.tv_create_time,item.getCreat_time());
        holder.setTextViewText(R.id.tv_save_num,item.getTijiao()+"/"+item.getTotal()+"人提交");
        TextView tvStatus = holder.getView(R.id.tv_status);
        if (item.getStatus().equals("1")){
            tvStatus.setText("已截止");
            tvStatus.setBackgroundResource(R.drawable.shape_round_gray_90);
        }else if(item.getStatus().equals("2")){
            tvStatus.setText("待批改");
            tvStatus.setBackgroundResource(R.drawable.shape_round_red_90);
        }else if(item.getStatus().equals("3")){
            tvStatus.setText("已评"+item.getShuliang()+"人");
            tvStatus.setBackgroundResource(R.drawable.shape_round_red_90);
        }else if(item.getStatus().equals("4")){
            tvStatus.setText("已完成");
            tvStatus.setBackgroundResource(R.drawable.shape_round_red_90);
        }
    }
}
